<template>

    <el-dialog
        :visible.sync="dialogVisible"
        title="备注"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
        width="500px"
    >
        <el-form ref="formRef" :model="formData" label-width="80px">
            <el-form-item prop="serviceRemark" label-width="0">
                <el-input type="textarea" v-model="formData.serviceRemark"/>
            </el-form-item>
            <el-form-item label-width="0" style="text-align: center">
                <el-popconfirm :title="'确定保存吗？'" @onConfirm="submitForm()">
                    <el-button slot="reference" type="primary">保存</el-button>
                </el-popconfirm>
            </el-form-item>
        </el-form>
    </el-dialog>
</template>

<script>
import {OrderApi} from '@/api/mall/order'

export default {
    name: 'MallOrderUpdateServiceRemark',
    components: {},
    data() {
        return {
            formData: {
                orderNo: '',
                serviceRemark: ''
            },
            dialogVisible: false
        }
    },
    methods: {
        // 显示组件
        showUpdate(data) {
            this.dialogVisible = true
            this.formData.orderNo = data.orderNo
            this.formData.serviceRemark = data.serviceRemark
        },

        // 提交表单
        submitForm() {
            const that = this
            that.$refs['formRef'].validate((valid) => {
                if (valid) {
                    OrderApi.updateServiceRemark(this.formData).then((response) => {
                        that.dialogVisible = false
                        that.$emit('refresh')
                    })
                }
            })
        }
    }
}
</script>

<style>

</style>
